package com.me.model.viewmodel;

import com.me.annotation.FieldAttr;
import com.me.enums.FieldType;
import com.me.model.Goods;

import java.math.BigDecimal;

public class GoodsViewModel {
	private String id;
	@FieldAttr("名字")
	private String name;
	@FieldAttr(value = "封面",type = FieldType.file)
	private String cover;
	@FieldAttr(value = "详情图片1",type = FieldType.file)
	private String image1;
	@FieldAttr(value = "详情图片2",type = FieldType.file)
	private String image2;
	@FieldAttr("价格")
	private float price;
	@FieldAttr("介绍")
	private String intro;
	@FieldAttr("库存")
	private int stock;
	@FieldAttr("类目")
	private String typeId;

	public GoodsViewModel() {

	}

	public GoodsViewModel(Goods g) {
		this.id = g.getId();
		this.name = g.getName();
		this.cover = g.getCover();
		this.image1 = g.getImage1();
		this.image2 = g.getImage2();
		this.price = g.getPrice();
		this.intro = g.getIntro();
		this.stock = g.getStock();
		this.typeId = g.getTypeId();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCover() {
		return cover;
	}

	public void setCover(String cover) {
		this.cover = cover;
	}

	public String getImage1() {
		return image1;
	}

	public void setImage1(String image1) {
		this.image1 = image1;
	}

	public String getImage2() {
		return image2;
	}

	public void setImage2(String image2) {
		this.image2 = image2;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = Float.parseFloat(price);
	}

	public String getIntro() {
		return intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	public int getStock() {
		return stock;
	}

	public void setStock(String stock) {
		this.stock = Integer.parseInt(stock);
	}

	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}
}
